package cn.bytecollege.admin.controller;

import cn.bytecollege.admin.service.ConsoleService;
import cn.bytecollege.common.constant.Resource;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "ConsoleController", value = "/super/console")
public class ConsoleController extends HttpServlet {
    private ConsoleService consoleService = null;
    public ConsoleController(){
        consoleService = new ConsoleService();
    }
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String,Integer> map = consoleService.count();
        request.setAttribute("map",map);
        request.getRequestDispatcher("/super/html/device/console.jsp")
                .forward(request,response);
    }
}
